package com.xinqi.modules.sys.stats.mapper;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xinqi.common.mybatis.data.repo.SuperMapper;
import com.xinqi.modules.sys.stats.domain.SchoolTeachingDayStEntity;
import com.xinqi.modules.sys.stats.dto.req.SchoolTeachingDayStQueryDTO;
import com.xinqi.modules.sys.stats.dto.rsp.SchoolOverviewResultDTO;
import com.xinqi.modules.sys.stats.dto.rsp.SchoolTeachingCountResultDTO;
import com.xinqi.modules.sys.stats.dto.rsp.SchoolTeachingDayStResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 学校教学数据统计数据层
 *
 * @author: wenjie
 * @date: 2023/08/24
 */
@Mapper
public interface SchoolTeachingDayStMapper extends SuperMapper<SchoolTeachingDayStEntity> {
    Page<SchoolTeachingDayStResultDTO> findPage(Page<Object> page, @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);

    List<SchoolTeachingDayStResultDTO> findList(@Param("dto") SchoolTeachingDayStQueryDTO query);

    List<SchoolTeachingDayStEntity> findAllSchools();

    List<SchoolTeachingCountResultDTO> findCountByRole(@Param("userRole") Integer userRole);

    List<SchoolTeachingCountResultDTO> findAddedCountByRoleAndDateRange(@Param("userRole") Integer userRole, @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);

    /**
     * 老师活跃数，只记录当天的
     *
     * @param userRole
     * @return
     */
    List<SchoolTeachingCountResultDTO> findActivityCountByRoleAndDateRange(@Param("userRole") Integer userRole, @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);

    List<SchoolTeachingCountResultDTO> findCourseContentCountByType(@Param("type") Integer type);

    List<SchoolTeachingCountResultDTO> findReleaseCourseContentByTypeAndDateRange(@Param("type") Integer type, @Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);

    List<SchoolTeachingCountResultDTO> findCourseClassCount();

    SchoolOverviewResultDTO overview();

    List<SchoolTeachingCountResultDTO> findContentSortListAndDateRange(@Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);

    List<SchoolTeachingCountResultDTO> findTodayAddedSchool();
}
